<?php defined("MAIN_DIR") or die("No direct access");

$error = false;

if ($route->POST('login') != "" && $route->POST('pass') != "") {
	
	// read vars
	$login = UV::readMQ($route->POST('login'));
	$pass = $route->POST('pass');
	
	// login user
	$login = $user->login($login,$pass);
	
	if ($login) {
		if (isset($_SERVER['HTTP_REFERER'])) {
			to($_SERVER['HTTP_REFERER']);
		} else {
			to("/admin/");
		}
	} else {
		$error = true;
	}
}

require_once ADMIN."login_form.php";

?>